<template>
  <div>
    <lt-echarts :options="option" width="100%" hight="300px" />
  </div>
</template>

<script lang="ts">
import { defineComponent, computed } from 'vue'
import ltEcharts from '../../baseEcharts/ltEchart.vue'
import * as echarts from 'echarts'
export default defineComponent({
  components: {
    ltEcharts
  },
  props: {
    sale: {
      type: Array
    },
    values: {
      type: Array
    }
  },
  setup(props) {
    var yMax = 500
    var dataShadow = []
    const option = computed(() => {
      return {
        title: {
          //text: '特性示例：渐变色 阴影 点击缩放'
          // subtext: 'Feature Sample: Gradient Color, Shadow, Click Zoom'
        },
        tooltip: {
          trigger: 'axis',
          axisPointer: {
            // 坐标轴指示器，坐标轴触发有效
            type: 'shadow' // 默认为直线，可选为：'line' | 'shadow'
          }
        },
        xAxis: {
          data: props.values,
          axisLabel: {
            inside: true,
            textStyle: {
              color: '#fff'
            }
          },
          axisTick: {
            show: false
          },
          axisLine: {
            show: false
          },
          z: 10
        },
        yAxis: {
          axisLine: {
            show: false
          },
          axisTick: {
            show: false
          },
          axisLabel: {
            textStyle: {
              color: '#999'
            }
          }
        },

        dataZoom: [
          {
            type: 'inside'
          }
        ],
        series: [
          {
            type: 'bar',

            showBackground: true,
            itemStyle: {
              color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
                { offset: 0, color: '#83bff6' },
                { offset: 0.5, color: '#188df0' },
                { offset: 1, color: '#188df0' }
              ])
            },
            emphasis: {
              itemStyle: {
                color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
                  { offset: 0, color: '#2378f7' },
                  { offset: 0.7, color: '#2378f7' },
                  { offset: 1, color: '#83bff6' }
                ])
              }
            },

            data: props.sale
          }
        ]
      }
    })

    return {
      option
    }
  }
})
</script>

<style scoped></style>
